# -*- coding: utf-8 -*-
import pygame
arrow1str = (  #sized 24x24
  "XX                      ",
  "XXX                     ",
  "XXXX                    ",
  "XX.XX                   ",
  "XX..XX                  ",
  "XX...XX                 ",
  "XX....XX                ",
  "XX.....XX               ",
  "XX......XX              ",
  "XX.......XX             ",
  "XX........XX            ",
  "XX........XXX           ",
  "XX......XXXXX           ",
  "XX.XXX..XX              ",
  "XXXX XX..XX             ",
  "XX   XX..XX             ",
  "     XX..XX             ",
  "      XX..XX            ",
  "      XX..XX            ",
  "       XXXX             ",
  "       XX               ",
  "                        ",
  "                        ",
  "                        ")
arrow2str = (
  "XX                      ",
  "XXX                     ",
  "XXXX                    ",
  "XXXXX                   ",
  "XXXXXX                  ",
  "XXXXXXX                 ",
  "XXXXXXXX                ",
  "XXXXXXXXX               ",
  "XXXXXXXXXX              ",
  "XXXXXXXXXXX             ",
  "XXXXXXXXXXXX            ",
  "XXXXXXXXXXXXX           ",
  "XXXXXXXXXXXXX           ",
  "XXXXXXXXXX              ",
  "XXXX XXXXXX             ",
  "XX   XXXXXX             ",
  "     XXXXXX             ",
  "      XXXXXX            ",
  "      XXXXXX            ",
  "       XXXX             ",
  "       XX               ",
  "                        ",
  "                        ",
  "                        ")
pygame.init()
screen = pygame.display.set_mode((800,600))
pygame.display.set_caption("Ex17.3")
background = pygame.Color(100, 149, 237)
cursor1 = pygame.cursors.compile(arrow1str,black='X',white='.',xor='o')
cursor2 = pygame.cursors.compile(arrow2str,black='X',white='.',xor='o')
pygame.mouse.set_cursor((24,24),(0,0),*cursor1)
running = True
while running:
    screen.fill(background)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
        if event.type == pygame.MOUSEMOTION:
            (x,y) = pygame.mouse.get_pos()
            print("(",x,",",y,")")
        if event.type == pygame.MOUSEBUTTONDOWN:
            pygame.mouse.set_cursor((24,24),(0,0),*cursor2)
            (button1, button2, button3) = pygame.mouse.get_pressed()
            print("You pressed :: Left=",button1," Middle=",button2," Right=",button3)
        if event.type == pygame.MOUSEBUTTONUP:
            pygame.mouse.set_cursor((24,24),(0,0),*cursor1)
            print("Mouse Button Released")

    pygame.display.flip()
pygame.quit()
